home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2000 November / Maximum CD 2000 Nov.iso / AofE-Conquerers / age2xtrial.exe / CABFILE / MSGAME.CAB / Data / gamedata_x1.drs / Unnamed File 000031.bina < prev   
Text File  |  2000-07-18  |  52KB  |  2,582 lines

  1. ;goals 1 and 2 = boats
  2. ;goal 3 = groups
  3. ;goal combat-arm = his unique unit type (also loads correct upgrades)
  4. ;goal 36 = good infantry -- 36 NO = don't build, YES = build, 
  5. ;    2 = only build if we don't have a castle. 
  6. ;goal 37 = good cavalry
  7. ;goal 38 = good horse-archers
  8. ;goal 39 = good archers
  9.  
  10. ;starting goals
  11. (defrule
  12.     (true)
  13. =>
  14.     (set-goal military-parity NO)    ;goal 3
  15.     (set-goal attack-control NO)    ;goal 4
  16.     (set-goal need-deathmatch-villagers NO)    ;goal 7
  17.  
  18.     (set-goal secondary-build YES)    ;goal 8
  19.     (set-goal soldiers-available NO);goal 10
  20.     (set-goal combat-supp NO)        ;goal 12
  21.  
  22.     (set-goal attack-enabled YES)    ;goal 13
  23.     (set-goal age-advancement NO)    ;goal 14
  24.     (set-goal make-warboat NO)        ;goal 15
  25.  
  26.     (disable-self)
  27. )
  28.  
  29. ;note that goal "enemy-soldiers" is, in wonder-kill, the siege-building goal. 
  30. (defrule
  31.     (true)
  32. =>
  33.     (set-goal upgrade-conflict NO)    ;goal 16
  34.     (set-goal pre-unique-arm NO)    ;goal 17
  35.     (set-goal sea-owner NO)            ;goal 23
  36.  
  37.     (set-goal siege-available YES)    ;goal 34
  38.     (disable-self)
  39. )
  40.  
  41. (defrule
  42.     (strategic-number sn-number-explore-groups != 1)
  43. =>
  44.     (set-strategic-number sn-number-explore-groups 1)
  45. )
  46.  
  47. ;which side are we?
  48. (defrule
  49.     (cc-players-building-type-count any-enemy wonder > 0)
  50. =>
  51.     (set-goal wonder-attempt ATTACK)
  52.     (enable-timer t-production 60)
  53.     (disable-self)
  54. )
  55.  
  56. (defrule
  57.     (building-type-count wonder > 0)
  58. =>
  59.     (set-goal wonder-attempt DEFEND)
  60.     (enable-timer t-production 60)
  61.     (disable-self)
  62. )
  63. ;***************************************************
  64. (defrule
  65.     (building-type-count-total castle == 0)
  66. =>
  67.     (set-strategic-number sn-wood-gatherer-percentage 25)
  68.     (set-strategic-number sn-food-gatherer-percentage 25)
  69.     (set-strategic-number sn-gold-gatherer-percentage 25)
  70.     (set-strategic-number sn-stone-gatherer-percentage 25)
  71. )
  72.  
  73. (defrule
  74.     (goal wonder-attempt ATTACK)
  75.     (building-type-count-total castle > 0)
  76. =>
  77.     (set-strategic-number sn-wood-gatherer-percentage 30)
  78.     (set-strategic-number sn-food-gatherer-percentage 30)
  79.     (set-strategic-number sn-gold-gatherer-percentage 35)
  80.     (set-strategic-number sn-stone-gatherer-percentage 5)
  81. )
  82.  
  83. (defrule
  84.     (goal wonder-attempt DEFEND)
  85.     (building-type-count-total castle > 0)
  86. =>
  87.     (set-strategic-number sn-wood-gatherer-percentage 30)
  88.     (set-strategic-number sn-food-gatherer-percentage 30)
  89.     (set-strategic-number sn-gold-gatherer-percentage 30)
  90.     (set-strategic-number sn-stone-gatherer-percentage 10)
  91. )
  92.  
  93. ;***************************************************
  94. (defrule
  95.     (difficulty == hardest)
  96.     (goal wonder-attempt ATTACK)
  97. =>
  98.     (cc-add-resource wood 10000)
  99.     (cc-add-resource food 10000)
  100.     (cc-add-resource gold 10000)
  101.     (cc-add-resource stone 10000)
  102.     (disable-self)
  103. )
  104.  
  105. (defrule
  106.     (difficulty == hard)
  107.     (goal wonder-attempt ATTACK)
  108. =>
  109.     (cc-add-resource wood 5000)
  110.     (cc-add-resource food 5000)
  111.     (cc-add-resource gold 5000)
  112.     (cc-add-resource stone 5000)
  113.     (disable-self)
  114. )
  115.  
  116. (defrule
  117.     (difficulty == moderate)
  118.     (goal wonder-attempt ATTACK)
  119. =>
  120.     (cc-add-resource wood 1000)
  121.     (cc-add-resource food 1500)
  122.     (cc-add-resource gold 1500)
  123.     (cc-add-resource stone 1000)
  124.     (disable-self)
  125. )
  126.  
  127. (defrule
  128.     (difficulty == hardest)
  129.     (goal wonder-attempt DEFEND)
  130. =>
  131.     (cc-add-resource wood 5000)
  132.     (cc-add-resource food 5000)
  133.     (cc-add-resource gold 5000)
  134.     (cc-add-resource stone 5000)
  135.     (disable-self)
  136. )
  137.  
  138. (defrule
  139.     (difficulty == hard)
  140.     (goal wonder-attempt DEFEND)
  141. =>
  142.     (cc-add-resource wood 1000)
  143.     (cc-add-resource food 1000)
  144.     (cc-add-resource gold 1000)
  145.     (cc-add-resource stone 1000)
  146.     (disable-self)
  147. )
  148.  
  149. (defrule
  150.     (difficulty == moderate)
  151.     (goal wonder-attempt DEFEND)
  152. =>
  153.     (cc-add-resource wood 500)
  154.     (cc-add-resource food 500)
  155.     (cc-add-resource gold 500)
  156.     (cc-add-resource stone 500)
  157.     (disable-self)
  158. )
  159.  
  160. ;***************************************************
  161.  
  162. (defrule
  163.     (difficulty <= moderate)
  164.     (building-type-count-total house <= fifteen-percent-pop)
  165.     (can-build house)
  166. =>
  167.     (build house)
  168. )
  169.  
  170. #load-if-defined DIFFICULTY-EASIEST
  171. (defrule
  172.     (military-population < 10)
  173.     (housing-headroom < 5)
  174.     (population-headroom > 0)
  175.     (can-build house)
  176. =>
  177.     (build house)
  178. )
  179. #end-if
  180.  
  181. #load-if-defined DIFFICULTY-EASY
  182. (defrule
  183.     (military-population < civ-dark-rush)
  184.     (housing-headroom < 5)
  185.     (population-headroom > 0)
  186.     (can-build house)
  187. =>
  188.     (build house)
  189. )
  190. #end-if
  191.  
  192. (defrule
  193.     (game-time < 900)
  194.     (building-type-count town-center == 0)
  195.     (can-build town-center)
  196. =>
  197.     (build town-center)
  198. )
  199.  
  200. (defrule
  201.     (building-type-count mining-camp == 0)
  202.     (resource-found gold)
  203.     (can-build mining-camp)
  204. =>
  205.     (build mining-camp)
  206. )
  207.  
  208. (defrule
  209.     (building-type-count mining-camp < 2)
  210.     (resource-found gold)
  211.     (resource-found stone)
  212.     (can-build mining-camp)
  213. =>
  214.     (build mining-camp)
  215. )
  216.  
  217. (defrule
  218.     (building-type-count lumber-camp == 0)
  219.     (can-build lumber-camp)
  220. =>
  221.     (build lumber-camp)
  222. )
  223.  
  224. ;poor monks
  225. (defrule
  226.     (military-population > thirty-percent-pop)
  227.     (unit-type-count-total monk == 0)
  228.     (can-train monk)
  229. =>
  230.     (train monk)
  231. )
  232.  
  233. ;fair monks
  234. (defrule
  235.     (military-population > thirty-percent-pop)
  236.     (unit-type-count-total monk <= five-percent-pop)
  237.     (goal monk-rating FAIR)
  238.     (can-train monk)
  239. =>
  240.     (train monk)
  241. )
  242.  
  243. ;good monks
  244. (defrule
  245.     (military-population > thirty-percent-pop)
  246.     (unit-type-count-total monk <= fifteen-percent-pop)
  247.     (goal monk-rating GOOD)
  248.     (not (civ-selected spanish) )
  249.     (can-train monk)
  250. =>
  251.     (train monk)
  252. )
  253.  
  254. ;good monks
  255. (defrule
  256.     (military-population > thirty-percent-pop)
  257.     (unit-type-count-total missionary <= fifteen-percent-pop)
  258.     (civ-selected spanish)
  259.     (can-train missionary)
  260. =>
  261.     (train missionary)
  262. )
  263.  
  264. (defrule
  265.     (goal wonder-attempt ATTACK)
  266.     (military-population > twenty-percent-pop)
  267.     (unit-type-count-total petard < 3)
  268.     (can-train petard)
  269. =>
  270.     (train petard)
  271. )
  272.  
  273. (defrule
  274.     (true)
  275. =>
  276.     (set-goal combat-supp NO)
  277. )
  278.  
  279. ;*********************************************************
  280. ;production routine
  281. (defrule
  282.     (unit-type-count-total battering-ram-line < 2)
  283.     (unit-type-count-total siege-onager < 2)
  284.     (unit-type-count-total trebuchet < 2)
  285.     (unit-type-count-total bombard-cannon < 2)
  286.     (unit-type-count-total elite-tarkan < 12)
  287.     (unit-type-count-total petard < 8)
  288.     (game-time > 300)
  289.     (wood-amount > 225)
  290.     (gold-amount > 225)
  291.     (not (goal siege-rating EXCELLENT) )
  292. =>
  293.     (set-goal combat-supp FAIR)
  294.     (generate-random-number 20)
  295. )
  296.  
  297. (defrule
  298.     (can-afford-unit galley)
  299.     (can-afford-unit teutonic-knight)
  300.     (can-afford-unit mameluke)
  301.     (nor 
  302.         (goal siege-rating EXCELLENT)
  303.         (goal combat-supp FAIR)
  304.     )
  305. =>
  306.     (generate-random-number 20)
  307.     (set-goal combat-supp YES)
  308. )
  309.  
  310. (defrule
  311.     (goal siege-rating EXCELLENT)
  312.     (difficulty <= moderate)
  313.     (unit-type-count-total battering-ram-line < five-percent-pop)
  314.     (unit-type-count-total siege-onager < five-percent-pop)
  315.     (unit-type-count-total trebuchet < five-percent-pop)
  316.     (unit-type-count-total bombard-cannon < five-percent-pop)
  317.     (unit-type-count-total elite-tarkan < 12)
  318.     (unit-type-count-total petard < 8)
  319.     (wood-amount > 225)
  320.     (gold-amount > 225)
  321. =>
  322.     (set-goal combat-supp FAIR)
  323.     (release-escrow wood)
  324.     (release-escrow gold)
  325.     (generate-random-number 20)
  326. )
  327.  
  328. (defrule
  329.     (goal siege-rating EXCELLENT)
  330.     (difficulty >= easy)
  331.     (unit-type-count-total battering-ram-line < 2)
  332.     (unit-type-count-total siege-onager < 1)
  333.     (unit-type-count-total trebuchet < 1)
  334.     (unit-type-count-total bombard-cannon < 1)
  335.     (unit-type-count-total elite-tarkan < 6)
  336.     (unit-type-count-total petard < 4)
  337.     (wood-amount > 225)
  338.     (gold-amount > 225)
  339. =>
  340.     (set-goal combat-supp FAIR)
  341.     (release-escrow wood)
  342.     (release-escrow gold)
  343.     (generate-random-number 20)
  344. )
  345.  
  346. (defrule
  347.     (goal combat-supp FAIR)
  348.     (random-number <= 5)
  349.     (or
  350.         (or
  351.             (unit-type-count champion >= 6)
  352.             (unit-type-count elite-eagle-warrior >= 6)
  353.         )
  354.         (or
  355.             (unit-type-count spearman-line >= 6)
  356.             (unit-type-count elite-jaguar-man >= 6)
  357.         )
  358.     )
  359.     (not (cc-players-building-type-count every-enemy bombard-tower > 0) )
  360.     (can-train battering-ram-line)
  361. =>
  362.     (train battering-ram-line)
  363.     (set-goal combat-supp NO)
  364. )
  365.  
  366. (defrule
  367.     (goal combat-supp FAIR)
  368.     (random-number <= 5)
  369.     (or
  370.         (or
  371.             (unit-type-count elite-teutonic-knight >= 6)
  372.             (unit-type-count elite-throwing-axeman >= 6)
  373.         )
  374.         (or
  375.             (unit-type-count elite-woad-raider >= 6)
  376.             (unit-type-count elite-huskarl >= 6)
  377.         )
  378.     )
  379.     (not (cc-players-building-type-count every-enemy bombard-tower > 0) )
  380.     (can-train battering-ram-line)
  381. =>
  382.     (train battering-ram-line)
  383.     (set-goal combat-supp NO)
  384. )
  385.  
  386. (defrule
  387.     (goal combat-supp FAIR)
  388.     (random-number <= 5)
  389.     (or
  390.             (unit-type-count elite-berserk >= 6)
  391.             (unit-type-count elite-samurai >= 6)
  392.     )
  393.     (not (cc-players-building-type-count every-enemy bombard-tower > 0) )
  394.     (can-train battering-ram-line)
  395. =>
  396.     (train battering-ram-line)
  397.     (set-goal combat-supp NO)
  398. )
  399.  
  400. (defrule
  401.     (goal combat-supp FAIR)
  402.     (random-number <= 10)
  403.     (can-train siege-onager)
  404. =>
  405.     (train siege-onager)
  406.     (set-goal combat-supp NO)
  407. )
  408.  
  409. (defrule
  410.     (goal combat-supp FAIR)
  411.     (random-number <= 15)
  412.     (can-train bombard-cannon)
  413. =>
  414.     (train bombard-cannon)
  415.     (set-goal combat-supp NO)
  416. )
  417.  
  418. (defrule
  419.     (goal combat-supp FAIR)
  420.     (random-number <= 20)
  421. =>
  422.     (train trebuchet)
  423.     (set-goal combat-supp NO)
  424. )
  425.  
  426. ;what if we're poor & need troops?
  427. (defrule
  428.     (or
  429.         (and
  430.             (goal siege-rating EXCELLENT)
  431.             (goal combat-supp NO)
  432.         )
  433.         (goal wonder-attempt DEFEND)
  434.     )
  435.     (timer-triggered t-production)
  436.     (can-afford-unit galley)
  437.     (can-afford-unit teutonic-knight)
  438.     (can-afford-unit mameluke)
  439. =>
  440.     (generate-random-number 20)
  441.     (set-goal combat-supp YES)
  442. )
  443.  
  444. ;*********************************************************
  445. ;*********************************************************
  446. #load-if-defined AZTEC-CIV
  447. ;train jaguar men, eagle men, champs, arbalests, siege-ram, siege-onager
  448. (defrule
  449.     (true)
  450. =>
  451.     (set-goal monk-rating GOOD)
  452.     (set-goal siege-rating FAIR)
  453.     (disable-self)
  454. )
  455.  
  456. (defrule
  457.     (goal combat-supp YES)
  458.     (random-number <= 8)
  459.     (or
  460.         (or
  461.             (cc-players-unit-type-count any-enemy champion > 6)
  462.             (cc-players-unit-type-count any-enemy elite-berserk > 6)
  463.         )
  464.         (or
  465.             (cc-players-unit-type-count any-enemy elite-samurai > 6)
  466.             (cc-players-unit-type-count any-enemy elite-teutonic-knight > 6)
  467.         )
  468.     )
  469.     (can-train elite-jaguar-man)
  470. =>
  471.     (train elite-jaguar-man)
  472.     (set-goal combat-supp NO)
  473. )
  474.  
  475. (defrule
  476.     (goal combat-supp YES)
  477.     (random-number <= 8)
  478.     (or
  479.         (or
  480.             (cc-players-unit-type-count any-enemy elite-throwing-axeman > 6)
  481.             (cc-players-unit-type-count any-enemy elite-woad-raider > 6)
  482.         )
  483.         (or
  484.             (cc-players-unit-type-count any-enemy elite-huskarl > 6)
  485.             (cc-players-unit-type-count any-enemy elite-jaguar-man > 6)
  486.         )
  487.     )
  488.     (can-train elite-jaguar-man)
  489. =>
  490.     (train elite-jaguar-man)
  491.     (set-goal combat-supp NO)
  492. )
  493.  
  494. (defrule
  495.     (goal combat-supp YES)
  496.     (random-number <= 12)
  497.     (can-train champion)
  498. =>
  499.     (train champion)
  500.     (set-goal combat-supp NO)
  501. )
  502.  
  503. (defrule
  504.     (goal combat-supp YES)
  505.     (random-number <= 16)
  506.     (can-train elite-eagle-warrior)
  507. =>
  508.     (train elite-eagle-warrior)
  509.     (set-goal combat-supp NO)
  510. )
  511.  
  512. (defrule
  513.     (goal combat-supp YES)
  514.     (random-number <= 20)
  515.     (can-train arbalest)
  516. =>
  517.     (train arbalest)
  518.     (set-goal combat-supp NO)
  519. )
  520.  
  521. #end-if
  522. ;*********************************************************
  523. #load-if-defined HUN-CIV
  524. ;train tarkans, paladins, hussars, heavy cav archers
  525. (defrule
  526.     (true)
  527. =>
  528.     (set-goal monk-rating FAIR)
  529.     (set-goal siege-rating POOR)
  530.     (disable-self)
  531. )
  532.  
  533. (defrule
  534.     (goal combat-supp YES)
  535.     (random-number <= 10)
  536.     (can-train elite-tarkan)
  537. =>
  538.     (train elite-tarkan)
  539.     (set-goal combat-supp NO)
  540. )
  541.  
  542. (defrule
  543.     (goal combat-supp YES)
  544.     (random-number <= 14)
  545.     (can-train heavy-cavalry-archer)
  546. =>
  547.     (train heavy-cavalry-archer)
  548.     (set-goal combat-supp NO)
  549. )
  550.  
  551. (defrule
  552.     (goal combat-supp YES)
  553.     (random-number <= 18)
  554.     (can-train paladin)
  555. =>
  556.     (train paladin)
  557.     (set-goal combat-supp NO)
  558. )
  559.  
  560. (defrule
  561.     (goal combat-supp YES)
  562.     (random-number <= 20)
  563.     (can-train hussar)
  564. =>
  565.     (train hussar)
  566.     (set-goal combat-supp NO)
  567. )
  568.  
  569. #end-if
  570. ;*********************************************************
  571. #load-if-defined KOREAN-CIV
  572. ;train war-wagons, hand-cannoneers, hussars, heavy cavalry archers, siege onagers
  573.  
  574. (defrule
  575.     (true)
  576. =>
  577.     (set-goal monk-rating FAIR)
  578.     (set-goal siege-rating FAIR)
  579.     (disable-self)
  580. )
  581.  
  582. (defrule
  583.     (goal combat-supp YES)
  584.     (random-number <= 10)
  585.     (not (can-train elite-war-wagon) )
  586.     (can-train-with-escrow elite-war-wagon)
  587. =>
  588.     (release-escrow wood)
  589.     (release-escrow gold)
  590. )
  591.  
  592. (defrule
  593.     (goal combat-supp YES)
  594.     (random-number <= 10)
  595.     (can-train elite-war-wagon)
  596. =>
  597.     (train elite-war-wagon)
  598.     (set-goal combat-supp NO)
  599. )
  600.  
  601. (defrule
  602.     (goal combat-supp YES)
  603.     (random-number <= 12)
  604.     (can-train hand-cannoneer)
  605. =>
  606.     (train hand-cannoneer)
  607.     (set-goal combat-supp NO)
  608. )
  609.  
  610. (defrule
  611.     (goal combat-supp YES)
  612.     (random-number <= 16)
  613.     (can-train heavy-cavalry-archer)
  614. =>
  615.     (train heavy-cavalry-archer)
  616.     (set-goal combat-supp NO)
  617. )
  618.  
  619. (defrule
  620.     (goal combat-supp YES)
  621.     (random-number <= 20)
  622.     (can-train hussar)
  623. =>
  624.     (train hussar)
  625.     (set-goal combat-supp NO)
  626. )
  627.  
  628. #end-if
  629. ;*********************************************************
  630. #load-if-defined MAYAN-CIV
  631. ;train plumed archers, elite-eagle-warriors, arbalests, siege rams
  632. (defrule
  633.     (true)
  634. =>
  635.     (set-goal monk-rating FAIR)
  636.     (set-goal siege-rating POOR)
  637.     (disable-self)
  638. )
  639.  
  640. (defrule
  641.     (goal combat-supp YES)
  642.     (random-number <= 6)
  643.     (can-train elite-plumed-archer)
  644. =>
  645.     (train elite-plumed-archer)
  646.     (set-goal combat-supp NO)
  647. )
  648.  
  649. (defrule
  650.     (goal combat-supp YES)
  651.     (random-number <= 10)
  652.     (can-train arbalest)
  653. =>
  654.     (train arbalest)
  655.     (set-goal combat-supp NO)
  656. )
  657.  
  658. (defrule
  659.     (goal combat-supp YES)
  660.     (random-number <= 20)
  661.     (can-train elite-eagle-warrior)
  662. =>
  663.     (train elite-eagle-warrior)
  664.     (set-goal combat-supp NO)
  665. )
  666.  
  667. #end-if
  668. ;*********************************************************
  669. #load-if-defined SPANISH-CIV
  670. ;train conquistadors, champs, paladins, hussars, handgunners, hvy cav archers, 
  671. ;bombard cannons
  672. (defrule
  673.     (true)
  674. =>
  675.     (set-goal monk-rating GOOD)
  676.     (set-goal siege-rating FAIR)
  677.     (disable-self)
  678. )
  679.  
  680. (defrule
  681.     (goal combat-supp YES)
  682.     (random-number <= 4)
  683.     (can-train elite-conquistador)
  684. =>
  685.     (train elite-conquistador)
  686.     (set-goal combat-supp NO)
  687. )
  688.  
  689. (defrule
  690.     (goal combat-supp YES)
  691.     (random-number <= 6)
  692.     (can-train champion)
  693. =>
  694.     (train champion)
  695.     (set-goal combat-supp NO)
  696. )
  697.  
  698. (defrule
  699.     (goal combat-supp YES)
  700.     (random-number <= 10)
  701.     (can-train paladin)
  702. =>
  703.     (train paladin)
  704.     (set-goal combat-supp NO)
  705. )
  706.  
  707. (defrule
  708.     (goal combat-supp YES)
  709.     (random-number <= 12)
  710.     (can-train hussar)
  711. =>
  712.     (train hussar)
  713.     (set-goal combat-supp NO)
  714. )
  715.  
  716. (defrule
  717.     (goal combat-supp YES)
  718.     (random-number <= 16)
  719.     (can-train hand-cannoneer)
  720. =>
  721.     (train hand-cannoneer)
  722.     (set-goal combat-supp NO)
  723. )
  724.  
  725. (defrule
  726.     (goal combat-supp YES)
  727.     (random-number <= 20)
  728.     (can-train heavy-cavalry-archer)
  729. =>
  730.     (train heavy-cavalry-archer)
  731.     (set-goal combat-supp NO)
  732. )
  733.  
  734. #end-if
  735. ;*********************************************************
  736. #load-if-defined BRITON-CIV
  737. ;train longbows, champs, hussar, arbalests
  738. (defrule
  739.     (true)
  740. =>
  741.     (set-goal monk-rating GOOD)
  742.     (set-goal siege-rating POOR)
  743.     (disable-self)
  744. )
  745.  
  746. (defrule
  747.     (goal combat-supp YES)
  748.     (random-number <= 10)
  749.     (can-train elite-longbowman)
  750. =>
  751.     (train elite-longbowman)
  752.     (set-goal combat-supp NO)
  753. )
  754.  
  755. (defrule
  756.     (goal combat-supp YES)
  757.     (random-number <= 12)
  758.     (can-train arbalest)
  759. =>
  760.     (train arbalest)
  761.     (set-goal combat-supp NO)
  762. )
  763.  
  764. (defrule
  765.     (goal combat-supp YES)
  766.     (random-number <= 18)
  767.     (can-train champion)
  768. =>
  769.     (train champion)
  770.     (set-goal combat-supp NO)
  771. )
  772.  
  773. (defrule
  774.     (goal combat-supp YES)
  775.     (random-number <= 20)
  776.     (can-train hussar)
  777. =>
  778.     (train hussar)
  779.     (set-goal combat-supp NO)
  780. )
  781.  
  782. #end-if
  783. ;*********************************************************
  784. #load-if-defined BYZANTINE-CIV
  785. ;train cataphracts, champion, paladin, hussar, hand-cannoneer, heavy-cavalry-archer
  786. ;bombard cannon, siege ram
  787. (defrule
  788.     (true)
  789. =>
  790.     (set-goal monk-rating GOOD)
  791.     (set-goal siege-rating POOR)
  792.     (disable-self)
  793. )
  794.  
  795. (defrule
  796.     (goal combat-supp YES)
  797.     (random-number <= 4)
  798.     (can-train elite-cataphract)
  799. =>
  800.     (train elite-cataphract)
  801.     (set-goal combat-supp NO)
  802. )
  803.  
  804. (defrule
  805.     (goal combat-supp YES)
  806.     (random-number <= 6)
  807.     (can-train paladin)
  808. =>
  809.     (train paladin)
  810.     (set-goal combat-supp NO)
  811. )
  812.  
  813. (defrule
  814.     (goal combat-supp YES)
  815.     (random-number <= 10)
  816.     (can-train champion)
  817. =>
  818.     (train champion)
  819.     (set-goal combat-supp NO)
  820. )
  821.  
  822. (defrule
  823.     (goal combat-supp YES)
  824.     (random-number <= 14)
  825.     (can-train hand-cannoneer)
  826. =>
  827.     (train hand-cannoneer)
  828.     (set-goal combat-supp NO)
  829. )
  830.  
  831. (defrule
  832.     (goal combat-supp YES)
  833.     (random-number <= 18)
  834.     (can-train heavy-cavalry-archer)
  835. =>
  836.     (train heavy-cavalry-archer)
  837.     (set-goal combat-supp NO)
  838. )
  839.  
  840. (defrule
  841.     (goal combat-supp YES)
  842.     (random-number <= 20)
  843.     (can-train hussar)
  844. =>
  845.     (train hussar)
  846.     (set-goal combat-supp NO)
  847. )
  848.  
  849. #end-if
  850. ;************************************************
  851. #load-if-defined CELTIC-CIV
  852. ;train woad raiders, champion, paladin, hand-cannoneer, siege-ram, siege-onager, heavy-scorpion
  853. (defrule
  854.     (true)
  855. =>
  856.     (set-goal monk-rating POOR)
  857.     (set-goal siege-rating GOOD)
  858.     (disable-self)
  859. )
  860.  
  861. (defrule
  862.     (goal combat-supp YES)
  863.     (random-number <= 6)
  864.     (can-train elite-woad-raider)
  865. =>
  866.     (train elite-woad-raider)
  867.     (set-goal combat-supp NO)
  868. )
  869.  
  870. (defrule
  871.     (goal combat-supp YES)
  872.     (random-number <= 8)
  873.     (can-train champion)
  874. =>
  875.     (train champion)
  876.     (set-goal combat-supp NO)
  877. )
  878.  
  879. (defrule
  880.     (goal combat-supp YES)
  881.     (random-number <= 12)
  882.     (can-train heavy-scorpion)
  883. =>
  884.     (train heavy-scorpion)
  885.     (set-goal combat-supp NO)
  886. )
  887.  
  888. (defrule
  889.     (goal combat-supp YES)
  890.     (random-number <= 16)
  891.     (can-train paladin)
  892. =>
  893.     (train paladin)
  894.     (set-goal combat-supp NO)
  895. )
  896.  
  897. (defrule
  898.     (goal combat-supp YES)
  899.     (random-number <= 20)
  900.     (can-train hand-cannoneer)
  901. =>
  902.     (train hand-cannoneer)
  903.     (set-goal combat-supp NO)
  904. )
  905.  
  906. #end-if
  907. ;********************************
  908. #load-if-defined CHINESE-CIV
  909. ;train chu-ko-nu, heavy scorpion, champs, arbalest,
  910. ; heavy-cavalry-archer, siege-ram 
  911. (defrule
  912.     (true)
  913. =>
  914.     (set-goal monk-rating FAIR)
  915.     (set-goal siege-rating POOR)
  916.     (disable-self)
  917. )
  918.  
  919. (defrule
  920.     (goal combat-supp YES)
  921.     (random-number <= 8)
  922.     (can-train elite-chu-ko-nu)
  923. =>
  924.     (train elite-chu-ko-nu)
  925.     (set-goal combat-supp NO)
  926. )
  927.  
  928. (defrule
  929.     (goal combat-supp YES)
  930.     (random-number <= 12)
  931.     (can-train heavy-scorpion)
  932. =>
  933.     (train heavy-scorpion)
  934.     (set-goal combat-supp NO)
  935. )
  936.  
  937. (defrule
  938.     (goal combat-supp YES)
  939.     (random-number <= 16)
  940.     (can-train champion)
  941. =>
  942.     (train champion)
  943.     (set-goal combat-supp NO)
  944. )
  945.  
  946. (defrule
  947.     (goal combat-supp YES)
  948.     (random-number <= 18)
  949.     (can-train arbalest)
  950. =>
  951.     (train arbalest)
  952.     (set-goal combat-supp NO)
  953. )
  954.  
  955. (defrule
  956.     (goal combat-supp YES)
  957.     (random-number <= 20)
  958.     (can-train heavy-cavalry-archer)
  959. =>
  960.     (train heavy-cavalry-archer)
  961.     (set-goal combat-supp NO)
  962. )
  963. #end-if
  964. ;*******************************
  965. #load-if-defined FRANKISH-CIV
  966. ;train throwing-axe, champions, paladins, hand-cannoneer, bombard-cannon
  967. (defrule
  968.     (true)
  969. =>
  970.     (set-goal monk-rating FAIR)
  971.     (set-goal siege-rating FAIR)
  972.     (disable-self)
  973. )
  974.  
  975. (defrule
  976.     (goal combat-supp YES)
  977.     (random-number <= 4)
  978.     (can-train elite-throwing-axeman)
  979. =>
  980.     (train elite-throwing-axeman)
  981.     (set-goal combat-supp NO)
  982. )
  983.  
  984. (defrule
  985.     (goal combat-supp YES)
  986.     (random-number <= 5)
  987.     (can-train champion)
  988. =>
  989.     (train champion)
  990.     (set-goal combat-supp NO)
  991. )
  992.  
  993. (defrule
  994.     (goal combat-supp YES)
  995.     (random-number <= 15)
  996.     (can-train paladin)
  997. =>
  998.     (train paladin)
  999.     (set-goal combat-supp NO)
  1000. )
  1001.  
  1002. (defrule
  1003.     (goal combat-supp YES)
  1004.     (random-number <= 20)
  1005.     (can-train hand-cannoneer)
  1006. =>
  1007.     (train hand-cannoneer)
  1008.     (set-goal combat-supp NO)
  1009. )
  1010. #end-if
  1011. ;****************************
  1012. #load-if-defined GOTHIC-CIV
  1013. ;train huskarls, champion, hussar, hand-cannoneer, bombard-cannon
  1014. (defrule
  1015.     (true)
  1016. =>
  1017.     (set-goal monk-rating POOR)
  1018.     (set-goal siege-rating POOR)
  1019.     (disable-self)
  1020. )
  1021.  
  1022. (defrule
  1023.     (goal combat-supp YES)
  1024.     (random-number <= 10)
  1025.     (or
  1026.         (or
  1027.             (cc-players-unit-type-count any-enemy arbalest > 6)
  1028.             (cc-players-unit-type-count any-enemy heavy-cavalry-archer > 6)
  1029.         )
  1030.         (or
  1031.             (cc-players-unit-type-count any-enemy hand-cannoneer > 6)
  1032.             (cc-players-unit-type-count any-enemy elite-chu-ko-nu > 6)
  1033.         )
  1034.     )
  1035.     (can-train elite-huskarl)
  1036. =>
  1037.     (train elite-huskarl)
  1038.     (set-goal combat-supp NO)
  1039. )
  1040.  
  1041. (defrule
  1042.     (goal combat-supp YES)
  1043.     (random-number <= 10)
  1044.     (or
  1045.         (or
  1046.             (cc-players-unit-type-count any-enemy elite-janissary > 6)
  1047.             (cc-players-unit-type-count any-enemy elite-longbowman > 6)
  1048.         )
  1049.         (or
  1050.             (cc-players-unit-type-count any-enemy elite-mangudai > 6)
  1051.             (cc-players-unit-type-count any-enemy elite-plumed-archer > 6)
  1052.         )
  1053.     )
  1054.     (can-train elite-huskarl)
  1055. =>
  1056.     (train elite-huskarl)
  1057.     (set-goal combat-supp NO)
  1058. )
  1059.  
  1060. (defrule
  1061.     (goal combat-supp YES)
  1062.     (random-number <= 10)
  1063.     (or
  1064.         (cc-players-unit-type-count any-enemy elite-conquistador > 6)
  1065.         (cc-players-unit-type-count any-enemy elite-war-wagon > 6)
  1066.     )
  1067.     (can-train elite-huskarl)
  1068. =>
  1069.     (train elite-huskarl)
  1070.     (set-goal combat-supp NO)
  1071. )
  1072.  
  1073. (defrule
  1074.     (goal combat-supp YES)
  1075.     (random-number <= 12)
  1076.     (can-train champion)
  1077. =>
  1078.     (train champion)
  1079.     (set-goal combat-supp NO)
  1080. )
  1081.  
  1082. (defrule
  1083.     (goal combat-supp YES)
  1084.     (random-number <= 14)
  1085.     (can-train hussar)
  1086. =>
  1087.     (train hussar)
  1088.     (set-goal combat-supp NO)
  1089. )
  1090.  
  1091. (defrule
  1092.     (goal combat-supp YES)
  1093.     (random-number <= 20)
  1094.     (can-train hand-cannoneer)
  1095. =>
  1096.     (train hand-cannoneer)
  1097.     (set-goal combat-supp NO)
  1098. )
  1099.  
  1100. #end-if
  1101. ;********************************
  1102. #load-if-defined JAPANESE-CIV
  1103. ;train samurai, champion, heavy-scorpion, hand-cannoneer, heavy-cavalry-archer
  1104. (defrule
  1105.     (true)
  1106. =>
  1107.     (set-goal monk-rating GOOD)
  1108.     (set-goal siege-rating GOOD)
  1109.     (disable-self)
  1110. )
  1111.  
  1112. (defrule
  1113.     (goal combat-supp YES)
  1114.     (random-number <= 8)
  1115.     (can-train elite-samurai)
  1116. =>
  1117.     (train elite-samurai)
  1118.     (set-goal combat-supp NO)
  1119. )
  1120.  
  1121. (defrule
  1122.     (goal combat-supp YES)
  1123.     (random-number <= 10)
  1124.     (can-train champion)
  1125. =>
  1126.     (train champion)
  1127.     (set-goal combat-supp NO)
  1128. )
  1129.  
  1130. (defrule
  1131.     (goal combat-supp YES)
  1132.     (random-number <= 14)
  1133.     (can-train heavy-scorpion)
  1134. =>
  1135.     (train heavy-scorpion)
  1136.     (set-goal combat-supp NO)
  1137. )
  1138.  
  1139. (defrule
  1140.     (goal combat-supp YES)
  1141.     (random-number <= 16)
  1142.     (can-train hand-cannoneer)
  1143. =>
  1144.     (train hand-cannoneer)
  1145.     (set-goal combat-supp NO)
  1146. )
  1147.  
  1148. (defrule
  1149.     (goal combat-supp YES)
  1150.     (random-number <= 20)
  1151.     (can-train heavy-cavalry-archer)
  1152. =>
  1153.     (train heavy-cavalry-archer)
  1154.     (set-goal combat-supp NO)
  1155. )
  1156. #end-if
  1157. ;*********************************
  1158. #load-if-defined MONGOL-CIV
  1159. ;trains mangudai, champs, hussars, arbalests, heavy-cavalry-archers
  1160. ;siege-ram, siege-onager, heavy-scorpion
  1161. (defrule
  1162.     (true)
  1163. =>
  1164.     (set-goal monk-rating POOR)
  1165.     (set-goal siege-rating GOOD)
  1166.     (disable-self)
  1167. )
  1168.  
  1169. (defrule
  1170.     (goal combat-supp YES)
  1171.     (random-number <= 8)
  1172.     (can-train elite-mangudai)
  1173. =>
  1174.     (train elite-mangudai)
  1175.     (set-goal combat-supp NO)
  1176. )
  1177.  
  1178. (defrule
  1179.     (goal combat-supp YES)
  1180.     (random-number <= 10)
  1181.     (can-train heavy-cavalry-archer)
  1182. =>
  1183.     (train heavy-cavalry-archer)
  1184.     (set-goal combat-supp NO)
  1185. )
  1186.  
  1187. (defrule
  1188.     (goal combat-supp YES)
  1189.     (random-number <= 12)
  1190.     (can-train heavy-scorpion)
  1191. =>
  1192.     (train heavy-scorpion)
  1193.     (set-goal combat-supp NO)
  1194. )
  1195.  
  1196. (defrule
  1197.     (goal combat-supp YES)
  1198.     (random-number <= 15)
  1199.     (can-train hussar)
  1200. =>
  1201.     (train hussar)
  1202.     (set-goal combat-supp NO)
  1203. )
  1204.  
  1205. (defrule
  1206.     (goal combat-supp YES)
  1207.     (random-number <= 17)
  1208.     (can-train arbalest)
  1209. =>
  1210.     (train arbalest)
  1211.     (set-goal combat-supp NO)
  1212. )
  1213.  
  1214. (defrule
  1215.     (goal combat-supp YES)
  1216.     (random-number <= 20)
  1217.     (can-train champion)
  1218. =>
  1219.     (train champion)
  1220.     (set-goal combat-supp NO)
  1221. )
  1222. #end-if
  1223. ;***********************************
  1224. #load-if-defined PERSIAN-CIV
  1225. ;trains elephants, paladin, hussar, hand-cannoneer, heavy-cavalry-archer, bombard-cannon
  1226. (defrule
  1227.     (true)
  1228. =>
  1229.     (set-goal monk-rating POOR)
  1230.     (set-goal siege-rating POOR)
  1231.     (disable-self)
  1232. )
  1233.  
  1234. (defrule
  1235.     (goal combat-supp YES)
  1236.     (random-number <= 10)
  1237.     (not (can-train elite-war-elephant) )
  1238.     (can-train-with-escrow elite-war-elephant)
  1239. =>
  1240.     (release-escrow food)
  1241.     (release-escrow gold)
  1242. )
  1243.  
  1244. (defrule
  1245.     (goal combat-supp YES)
  1246.     (random-number <= 10)
  1247.     (can-train elite-war-elephant)
  1248. =>
  1249.     (train elite-war-elephant)
  1250.     (set-goal combat-supp NO)
  1251. )
  1252.  
  1253. (defrule
  1254.     (goal combat-supp YES)
  1255.     (random-number <= 12)
  1256.     (can-train paladin)
  1257. =>
  1258.     (train paladin)
  1259.     (set-goal combat-supp NO)
  1260. )
  1261.  
  1262. (defrule
  1263.     (goal combat-supp YES)
  1264.     (random-number <= 14)
  1265.     (can-train hussar)
  1266. =>
  1267.     (train hussar)
  1268.     (set-goal combat-supp NO)
  1269. )
  1270.  
  1271. (defrule
  1272.     (goal combat-supp YES)
  1273.     (random-number <= 16)
  1274.     (can-train hand-cannoneer)
  1275. =>
  1276.     (train hand-cannoneer)
  1277.     (set-goal combat-supp NO)
  1278. )
  1279.  
  1280. (defrule
  1281.     (goal combat-supp YES)
  1282.     (random-number <= 20)
  1283.     (can-train heavy-cavalry-archer)
  1284. =>
  1285.     (train heavy-cavalry-archer)
  1286.     (set-goal combat-supp NO)
  1287. )
  1288.  
  1289. #end-if
  1290. ;***********************************
  1291. #load-if-defined SARACEN-CIV
  1292. ;trains mamluks, champions, hussar, arbalest, heavy-cavalry-archer
  1293. ;bombard-cannon, siege-ram, siege-onager
  1294. (defrule
  1295.     (true)
  1296. =>
  1297.     (set-goal monk-rating GOOD)
  1298.     (set-goal siege-rating FAIR)
  1299.     (disable-self)
  1300. )
  1301.  
  1302. (defrule
  1303.     (goal combat-supp YES)
  1304.     (random-number <= 6)
  1305.     (can-train elite-mameluke)
  1306. =>
  1307.     (train elite-mameluke)
  1308.     (set-goal combat-supp NO)
  1309. )
  1310.  
  1311. (defrule
  1312.     (goal combat-supp YES)
  1313.     (random-number <= 10)
  1314.     (can-train heavy-cavalry-archer)
  1315. =>
  1316.     (train heavy-cavalry-archer)
  1317.     (set-goal combat-supp NO)
  1318. )
  1319.  
  1320. (defrule
  1321.     (goal combat-supp YES)
  1322.     (random-number <= 12)
  1323.     (can-train hussar)
  1324. =>
  1325.     (train hussar)
  1326.     (set-goal combat-supp NO)
  1327. )
  1328.  
  1329. (defrule
  1330.     (goal combat-supp YES)
  1331.     (random-number <= 16)
  1332.     (can-train arbalest)
  1333. =>
  1334.     (train arbalest)
  1335.     (set-goal combat-supp NO)
  1336. )
  1337.  
  1338. (defrule
  1339.     (goal combat-supp YES)
  1340.     (random-number <= 20)
  1341.     (can-train champion)
  1342. =>
  1343.     (train champion)
  1344.     (set-goal combat-supp NO)
  1345. )
  1346. #end-if
  1347. ;*********************************
  1348. #load-if-defined TEUTONIC-CIV
  1349. ;trains TK, champion, paladin, hand-cannoneer, bombard-cannon, siege-onager
  1350. (defrule
  1351.     (true)
  1352. =>
  1353.     (set-goal monk-rating GOOD)
  1354.     (set-goal siege-rating FAIR)
  1355.     (disable-self)
  1356. )
  1357.  
  1358. (defrule
  1359.     (goal combat-supp YES)
  1360.     (random-number <= 8)
  1361.     (can-train elite-teutonic-knight)
  1362. =>
  1363.     (train elite-teutonic-knight)
  1364.     (set-goal combat-supp NO)
  1365. )
  1366.  
  1367. (defrule
  1368.     (goal combat-supp YES)
  1369.     (random-number <= 12)
  1370.     (can-train paladin)
  1371. =>
  1372.     (train paladin)
  1373.     (set-goal combat-supp NO)
  1374. )
  1375.  
  1376. (defrule
  1377.     (goal combat-supp YES)
  1378.     (random-number <= 16)
  1379.     (can-train champion)
  1380. =>
  1381.     (train champion)
  1382.     (set-goal combat-supp NO)
  1383. )
  1384.  
  1385. (defrule
  1386.     (goal combat-supp YES)
  1387.     (random-number <= 20)
  1388.     (can-train hand-cannoneer)
  1389. =>
  1390.     (train hand-cannoneer)
  1391.     (set-goal combat-supp NO)
  1392. )
  1393. #end-if
  1394. ;************************************
  1395. #load-if-defined TURKISH-CIV
  1396. ;trains janissaries, champion, hussar, hand-cannoneer, bombard-cannon
  1397. (defrule
  1398.     (true)
  1399. =>
  1400.     (set-goal monk-rating FAIR)
  1401.     (set-goal siege-rating GOOD)
  1402.     (disable-self)
  1403. )
  1404.  
  1405. (defrule
  1406.     (goal combat-supp YES)
  1407.     (random-number <= 10)
  1408.     (can-train elite-janissary)
  1409. =>
  1410.     (train elite-janissary)
  1411.     (set-goal combat-supp NO)
  1412. )
  1413.  
  1414. (defrule
  1415.     (goal combat-supp YES)
  1416.     (random-number <= 12)
  1417.     (can-train hand-cannoneer)
  1418. =>
  1419.     (train hand-cannoneer)
  1420.     (set-goal combat-supp NO)
  1421. )
  1422.  
  1423. (defrule
  1424.     (goal combat-supp YES)
  1425.     (random-number <= 18)
  1426.     (can-train champion)
  1427. =>
  1428.     (train champion)
  1429.     (set-goal combat-supp NO)
  1430. )
  1431.  
  1432. (defrule
  1433.     (goal combat-supp YES)
  1434.     (random-number <= 20)
  1435.     (can-train hussar)
  1436. =>
  1437.     (train hussar)
  1438.     (set-goal combat-supp NO)
  1439. )
  1440. #end-if
  1441. ;********************************
  1442. #load-if-defined VIKING-CIV
  1443. ;trains berserks, champion, arbalest, siege-ram
  1444. (defrule
  1445.     (true)
  1446. =>
  1447.     (set-goal monk-rating POOR)
  1448.     (set-goal siege-rating FAIR)
  1449.     (disable-self)
  1450. )
  1451.  
  1452. (defrule
  1453.     (goal combat-supp YES)
  1454.     (random-number <= 12)
  1455.     (can-train elite-berserk)
  1456. =>
  1457.     (train elite-berserk)
  1458.     (set-goal combat-supp NO)
  1459. )
  1460.  
  1461. (defrule
  1462.     (goal combat-supp YES)
  1463.     (random-number <= 14)
  1464.     (can-train champion)
  1465. =>
  1466.     (train champion)
  1467.     (set-goal combat-supp NO)
  1468. )
  1469.  
  1470. (defrule
  1471.     (goal combat-supp YES)
  1472.     (random-number <= 20)
  1473.     (can-train arbalest)
  1474. =>
  1475.     (train arbalest)
  1476.     (set-goal combat-supp NO)
  1477. )
  1478. #end-if
  1479. ;*********************************************************
  1480. ;who will be the siege meister? 
  1481. (defrule
  1482.     (difficulty <= moderate)
  1483.     (taunt-detected any-ally 230)
  1484. =>
  1485.     (set-goal siege-rating NO)
  1486.     (acknowledge-taunt this-any-ally 230)
  1487.     (disable-self)
  1488. )
  1489.  
  1490. (defrule
  1491.     (goal siege-rating GOOD)
  1492.     (difficulty <= moderate)
  1493.     (game-time >= 10)
  1494.     (player-computer any-ally)
  1495. =>
  1496.     (set-goal siege-rating EXCELLENT)
  1497.     (chat-to-player-using-id every-ally 22409)    ;230
  1498.     (disable-self)
  1499. )
  1500.  
  1501. (defrule
  1502.     (goal siege-rating FAIR)
  1503.     (difficulty <= moderate)
  1504.     (game-time >= 30)
  1505.     (player-computer any-ally)
  1506. =>
  1507.     (set-goal siege-rating EXCELLENT)
  1508.     (chat-to-player-using-id every-ally 22409)    ;230
  1509.     (disable-self)
  1510. )
  1511.  
  1512. (defrule
  1513.     (goal siege-rating POOR)
  1514.     (difficulty <= moderate)
  1515.     (game-time >= 50)
  1516.     (player-computer any-ally)
  1517. =>
  1518.     (set-goal siege-rating EXCELLENT)
  1519.     (chat-to-player-using-id every-ally 22409)    ;230
  1520.     (disable-self)
  1521. )
  1522.  
  1523. (defrule
  1524.     (goal wonder-attempt DEFEND)
  1525.     (not (goal siege-rating NO) )
  1526. =>
  1527.     (set-goal siege-rating NO)
  1528. )
  1529.  
  1530. (defrule
  1531.     (true)
  1532. =>
  1533.     (set-escrow-percentage wood 40)
  1534.     (set-escrow-percentage food 0)
  1535.     (set-escrow-percentage gold 40)
  1536.     (set-escrow-percentage stone 0)
  1537.     (disable-self)
  1538. )
  1539.  
  1540. (defrule
  1541.     (goal siege-rating EXCELLENT)
  1542. =>
  1543.     (set-escrow-percentage wood 70)
  1544.     (set-escrow-percentage gold 70)
  1545.     (disable-self)
  1546. )
  1547.  
  1548. (defrule
  1549.     (civ-selected persian)
  1550. =>
  1551.     (set-escrow-percentage food 40)
  1552.     (disable-self)
  1553. )
  1554.  
  1555. ;***************************************************
  1556. ;restart emergency production timer
  1557. (defrule
  1558.     (timer-triggered t-production)
  1559. =>
  1560.     (disable-timer t-production)
  1561.     (enable-timer t-production 60)
  1562. )
  1563.  
  1564. ;*********************************************************
  1565. #load-if-defined DIFFICULTY-EASIEST
  1566. (defrule
  1567.     (true)
  1568. =>
  1569.     (set-strategic-number sn-percent-enemy-sighted-response 10)
  1570.     (set-strategic-number sn-consecutive-idle-unit-limit 60)
  1571.     (set-strategic-number sn-easiest-reaction-percentage 20)
  1572.     (set-difficulty-parameter ability-to-maintain-distance 100)
  1573.     (set-difficulty-parameter ability-to-dodge-missiles 100)
  1574.     (disable-self)
  1575. )
  1576. #end-if
  1577. ;********************************
  1578. #load-if-defined DIFFICULTY-EASY
  1579.  
  1580. (defrule
  1581.     (true)
  1582. =>
  1583.     (set-strategic-number sn-percent-enemy-sighted-response 25)
  1584.     (set-strategic-number sn-consecutive-idle-unit-limit 20)
  1585.     (set-strategic-number sn-easier-reaction-percentage 20)
  1586.     (set-strategic-number sn-hits-before-alliance-change 50)
  1587.     (set-difficulty-parameter ability-to-maintain-distance 75)
  1588.     (set-difficulty-parameter ability-to-dodge-missiles 75)
  1589.     (disable-self)
  1590. )
  1591. #end-if
  1592.  
  1593. ;********************************
  1594. #load-if-defined DIFFICULTY-MODERATE
  1595.  
  1596. (defrule
  1597.     (true)
  1598. =>
  1599.     (set-strategic-number sn-percent-enemy-sighted-response 75)
  1600.     (set-strategic-number sn-consecutive-idle-unit-limit 5)
  1601.     (set-strategic-number sn-hits-before-alliance-change 25)
  1602.     (set-difficulty-parameter ability-to-maintain-distance 50)
  1603.     (set-difficulty-parameter ability-to-dodge-missiles 50)
  1604.     (disable-self)
  1605. )
  1606. #end-if
  1607.  
  1608. ;********************************
  1609. #load-if-defined DIFFICULTY-HARD
  1610.  
  1611. (defrule
  1612.     (true)
  1613. =>
  1614.     (set-strategic-number sn-percent-enemy-sighted-response 99)
  1615.     (set-strategic-number sn-consecutive-idle-unit-limit 1)
  1616.     (set-strategic-number sn-hits-before-alliance-change 10)
  1617.     (set-difficulty-parameter ability-to-maintain-distance 0)
  1618.     (set-difficulty-parameter ability-to-dodge-missiles 0)
  1619.     (disable-self)
  1620. )
  1621. #end-if
  1622.  
  1623. ;********************************
  1624. #load-if-defined DIFFICULTY-HARDEST
  1625.  
  1626. (defrule
  1627.     (true)
  1628. =>
  1629.     (set-strategic-number sn-percent-enemy-sighted-response 99)
  1630.     (set-strategic-number sn-consecutive-idle-unit-limit 1)
  1631.     (set-strategic-number sn-hits-before-alliance-change 10)
  1632.     (set-difficulty-parameter ability-to-maintain-distance 0)
  1633.     (set-difficulty-parameter ability-to-dodge-missiles 0)
  1634.     (disable-self)
  1635. )
  1636.  
  1637. (defrule
  1638.     (true)
  1639. =>
  1640.     (disable-timer t-chatmore)
  1641.     (enable-timer t-chatmore 1200)
  1642.     (disable-self)
  1643. )
  1644.  
  1645. (defrule
  1646.     (timer-triggered t-chatmore)
  1647. =>
  1648.     (cc-add-resource wood 500)
  1649.     (cc-add-resource food 500)
  1650.     (cc-add-resource gold 500)
  1651.     (cc-add-resource stone 500)
  1652.     (disable-timer t-chatmore)
  1653.     (enable-timer t-chatmore 1200)
  1654. )
  1655.  
  1656. #end-if
  1657. ;********************************
  1658. ;********************************
  1659.  
  1660. (defrule
  1661.     (true)
  1662. =>
  1663.     (set-strategic-number sn-coop-share-information 1)
  1664.     (set-strategic-number sn-coop-share-attacking 1)
  1665.     (set-strategic-number sn-maximum-town-size imperial-town-size)
  1666.  
  1667.     (set-strategic-number sn-task-ungrouped-soldiers 0)
  1668.     (set-strategic-number sn-zero-priority-distance 250)
  1669.     (set-strategic-number sn-blot-exploration-map 0)
  1670.  
  1671.     (set-strategic-number sn-attack-intelligence 1)
  1672.     (set-strategic-number sn-gather-defense-units 1)
  1673.     (set-strategic-number sn-defense-distance 2)
  1674.  
  1675.     (set-strategic-number sn-maximum-gaia-attack-response 1)
  1676.     (set-strategic-number sn-ignore-attack-group-under-attack 1)
  1677.     (set-strategic-number sn-allow-civilian-defense 0)
  1678.  
  1679.     (disable-self)
  1680. )
  1681.  
  1682. (defrule
  1683.     (true)
  1684. =>
  1685.     (set-strategic-number sn-stone-dropsite-distance 3)
  1686.     (set-strategic-number sn-gold-dropsite-distance 3)
  1687.     (set-strategic-number sn-retask-gather-amount 20)
  1688.  
  1689.     (set-strategic-number sn-camp-max-distance 15)
  1690.     (set-strategic-number sn-mill-max-distance 15)
  1691.     (set-strategic-number sn-enemy-sighted-response-distance 15)
  1692.     
  1693.     (set-strategic-number sn-group-form-distance 10)
  1694.     (set-strategic-number sn-town-defend-priority 7)
  1695.     (set-strategic-number sn-gold-defend-priority 2)
  1696.  
  1697.     (set-strategic-number sn-stone-defend-priority 3)
  1698.     (set-strategic-number sn-forage-defend-priority 0)
  1699.     (set-strategic-number sn-relic-defend-priority 0)
  1700.  
  1701.     (disable-self)
  1702. )
  1703.  
  1704. (defrule
  1705.     (true)
  1706. =>
  1707.     (set-strategic-number sn-cap-civilian-gatherers 100)
  1708.     (set-strategic-number sn-percent-civilian-gatherers 0)
  1709.     (set-strategic-number sn-minimum-civilian-explorers 0)
  1710.  
  1711.     (set-strategic-number sn-cap-civilian-explorers 0)
  1712.     (set-strategic-number sn-percent-civilian-explorers 0)
  1713.     (set-strategic-number sn-cap-civilian-builders 12)
  1714.  
  1715.     (set-strategic-number sn-percent-civilian-builders 100)
  1716.  
  1717.     (disable-self)
  1718. )
  1719.  
  1720. (defrule
  1721.     (or
  1722.         (building-type-count barracks > 0)
  1723.         (or
  1724.             (building-type-count stable > 0)
  1725.             (building-type-count archery-range > 0)
  1726.         )
  1727.     )
  1728. =>
  1729.     (set-strategic-number sn-percent-civilian-builders 15)
  1730.     (set-strategic-number sn-percent-civilian-gatherers 85)
  1731.     (disable-self)
  1732. )
  1733.  
  1734. (defrule
  1735.     (strategic-number sn-percent-civilian-gatherers == 85)
  1736.     (building-type-count castle > 0)
  1737. =>
  1738.     (set-strategic-number sn-percent-civilian-builders 10)
  1739.     (set-strategic-number sn-percent-civilian-gatherers 90)
  1740.     (disable-self)
  1741. )
  1742.  
  1743. ; villager count
  1744. (defrule
  1745.     (can-train villager)
  1746.     (civilian-population < 10)
  1747. =>
  1748.     (train villager)
  1749. )
  1750.  
  1751. (defrule
  1752.     (can-train villager)
  1753.     (civilian-population < civ-castle)
  1754.     (or
  1755.         (or
  1756.             (wood-amount < 1000)
  1757.             (food-amount < 1000)
  1758.         )
  1759.         (or
  1760.             (gold-amount < 1000)
  1761.             (stone-amount < 1000)
  1762.         )
  1763.     )
  1764. =>
  1765.     (train villager)
  1766. )
  1767.  
  1768. ;*********************************
  1769. ;buildings
  1770. (defrule
  1771.     (difficulty <= moderate)
  1772.     (housing-headroom < 5)
  1773.     (population-headroom > 0)
  1774.     (can-build house)
  1775. =>
  1776.     (build house)
  1777. )
  1778.  
  1779. #load-if-defined DIFFICULTY-EASIEST
  1780. (defrule
  1781.     (military-population < 10)
  1782.     (housing-headroom < 5)
  1783.     (population-headroom > 0)
  1784.     (can-build house)
  1785. =>
  1786.     (build house)
  1787. )
  1788. #end-if
  1789.  
  1790. #load-if-defined DIFFICULTY-EASY
  1791. (defrule
  1792.     (military-population < civ-dark-rush)
  1793.     (housing-headroom < 5)
  1794.     (population-headroom > 0)
  1795.     (can-build house)
  1796. =>
  1797.     (build house)
  1798. )
  1799. #end-if
  1800.  
  1801. (defrule
  1802.     (game-time < 900)
  1803.     (building-type-count town-center < 3)
  1804.     (can-build town-center)
  1805. =>
  1806.     (build town-center)
  1807. )
  1808.  
  1809. (defrule
  1810.     (building-type-count mining-camp == 0)
  1811.     (resource-found gold)
  1812.     (can-build mining-camp)
  1813. =>
  1814.     (build mining-camp)
  1815. )
  1816.  
  1817. (defrule
  1818.     (building-type-count mining-camp < 2)
  1819.     (resource-found gold)
  1820.     (resource-found stone)
  1821.     (can-build mining-camp)
  1822. =>
  1823.     (build mining-camp)
  1824. )
  1825.  
  1826. (defrule
  1827.     (building-type-count lumber-camp == 0)
  1828.     (can-build lumber-camp)
  1829. =>
  1830.     (build lumber-camp)
  1831. )
  1832.  
  1833. (defrule
  1834.     (game-time > 60)
  1835.     (building-type-count-total market == 0)
  1836.     (can-build market)
  1837. =>
  1838.     (build market)
  1839. )
  1840.  
  1841. (defrule
  1842.     (building-type-count castle == 0)
  1843.     (can-build castle)
  1844. =>
  1845.     (build castle)
  1846. )
  1847.  
  1848. (defrule
  1849.     (building-type-count castle > 0)
  1850.     (building-type-count castle < 4)
  1851.     (can-build castle)
  1852. =>
  1853.     (build-forward castle)
  1854. )
  1855.  
  1856. (defrule
  1857.     (building-type-count-total siege-workshop == 0)
  1858.     (can-build siege-workshop)
  1859. =>
  1860.     (build siege-workshop)
  1861. )
  1862.  
  1863. (defrule
  1864.     (building-type-count-total siege-workshop <= 1)
  1865.     (goal siege-rating POOR)
  1866.     (can-build siege-workshop)
  1867. =>
  1868.     (build-forward siege-workshop)
  1869. )
  1870.  
  1871. (defrule
  1872.     (building-type-count-total siege-workshop > 0)
  1873.     (building-type-count-total siege-workshop <= 2)
  1874.     (goal siege-rating FAIR)
  1875.     (can-build siege-workshop)
  1876. =>
  1877.     (build-forward siege-workshop)
  1878. )
  1879.  
  1880. (defrule
  1881.     (building-type-count-total siege-workshop > 0)
  1882.     (building-type-count-total siege-workshop <= 3)
  1883.     (goal siege-rating GOOD)
  1884.     (can-build siege-workshop)
  1885. =>
  1886.     (build-forward siege-workshop)
  1887. )
  1888.  
  1889. (defrule
  1890.     (building-type-count-total monastery == 0)
  1891.     (can-build monastery)
  1892. =>
  1893.     (build monastery)
  1894. )
  1895.  
  1896. (defrule
  1897.     (building-type-count-total monastery <= 1)
  1898.     (goal monk-rating FAIR)
  1899.     (can-build monastery)
  1900. =>
  1901.     (build monastery)
  1902. )
  1903.  
  1904. (defrule
  1905.     (building-type-count-total monastery <= 2)
  1906.     (goal monk-rating GOOD)
  1907.     (can-build monastery)
  1908. =>
  1909.     (build monastery)
  1910. )
  1911.  
  1912. (defrule
  1913.     (building-type-count-total barracks == 0)
  1914.     (nor
  1915.         (civ-selected hun)
  1916.         (or
  1917.             (civ-selected korean)
  1918.             (civ-selected persian)
  1919.         )
  1920.     )
  1921.     (can-build barracks)
  1922. =>
  1923.     (build barracks)
  1924. )
  1925.  
  1926. (defrule
  1927.     (building-type-count-total barracks > 0)
  1928.     (building-type-count-total barracks <= 2)
  1929.     (or
  1930.         (or
  1931.             (civ-selected briton)
  1932.             (civ-selected chinese)
  1933.         )
  1934.         (or
  1935.             (civ-selected teutonic)
  1936.             (civ-selected turkish)
  1937.         )
  1938.     )
  1939.     (can-build barracks)
  1940. =>
  1941.     (build-forward barracks)
  1942. )
  1943.  
  1944. (defrule
  1945.     (building-type-count-total barracks > 0)
  1946.     (building-type-count-total barracks <= 3)
  1947.     (or
  1948.         (or
  1949.             (civ-selected aztec)
  1950.             (civ-selected mayan)
  1951.         )
  1952.         (or
  1953.             (civ-selected gothic)
  1954.             (or
  1955.                 (civ-selected japanese)
  1956.                 (civ-selected viking)
  1957.             )
  1958.         )
  1959.     )
  1960.     (can-build barracks)
  1961. =>
  1962.     (build-forward barracks)
  1963. )
  1964.  
  1965. (defrule
  1966.     (building-type-count-total archery-range == 0)
  1967.     (can-build archery-range)
  1968. =>
  1969.     (build archery-range)
  1970. )
  1971.  
  1972. (defrule
  1973.     (building-type-count-total archery-range == 1)
  1974.     (can-build archery-range)
  1975. =>
  1976.     (build-forward archery-range)
  1977. )
  1978.  
  1979. (defrule
  1980.     (building-type-count-total archery-range > 0)
  1981.     (building-type-count-total archery-range <= 2)
  1982.     (or
  1983.         (or
  1984.             (civ-selected hun)
  1985.             (civ-selected korean)
  1986.         )
  1987.         (or
  1988.             (or
  1989.                 (civ-selected mayan)
  1990.                 (civ-selected spanish)
  1991.             )
  1992.             (or
  1993.                 (civ-selected briton)
  1994.                 (civ-selected chinese)
  1995.             )
  1996.         )
  1997.     )
  1998.     (can-build archery-range)
  1999. =>
  2000.     (build-forward archery-range)
  2001. )
  2002.  
  2003. (defrule
  2004.     (building-type-count-total archery-range > 0)
  2005.     (building-type-count-total archery-range <= 3)
  2006.     (or
  2007.         (or
  2008.             (civ-selected japanese)
  2009.             (civ-selected mongol)
  2010.         )
  2011.         (or
  2012.             (civ-selected persian)
  2013.             (civ-selected viking)
  2014.         )
  2015.     )
  2016.     (can-build archery-range)
  2017. =>
  2018.     (build-forward archery-range)
  2019. )
  2020.  
  2021. (defrule
  2022.     (building-type-count-total stable == 0)
  2023.     (nor
  2024.         (or
  2025.             (civ-selected aztec)
  2026.             (civ-selected mayan)
  2027.         )
  2028.         (or
  2029.             (civ-selected chinese)
  2030.             (or
  2031.                 (civ-selected japanese)
  2032.                 (civ-selected viking)
  2033.             )
  2034.         )
  2035.     )
  2036.     (can-build stable)
  2037. =>
  2038.     (build stable)
  2039. )
  2040.  
  2041. (defrule
  2042.     (building-type-count-total stable == 1)
  2043.     (or
  2044.         (or
  2045.             (civ-selected briton)
  2046.             (civ-selected byzantine)
  2047.         )
  2048.         (or
  2049.             (or
  2050.                 (civ-selected celtic)
  2051.                 (civ-selected mongol)
  2052.             )
  2053.             (or
  2054.                 (civ-selected teutonic)
  2055.                 (civ-selected turkish)
  2056.             )
  2057.         )
  2058.     )
  2059.     (can-build stable)
  2060. =>
  2061.     (build-forward stable)
  2062. )
  2063.  
  2064. (defrule
  2065.     (building-type-count-total stable > 0)
  2066.     (building-type-count-total stable <= 3)
  2067.     (or
  2068.         (or
  2069.             (civ-selected hun)
  2070.             (civ-selected spanish)
  2071.         )
  2072.         (or
  2073.             (civ-selected frankish)
  2074.             (civ-selected persian)
  2075.         )
  2076.     )
  2077.     (can-build stable)
  2078. =>
  2079.     (build-forward stable)
  2080. )
  2081.  
  2082. ;***********************************
  2083. ;MARKET STUFF
  2084. ;***********************************
  2085. (defrule
  2086.     (wood-amount > 500)
  2087.     (or
  2088.         (food-amount < 200)
  2089.         (or
  2090.             (gold-amount < 225)
  2091.             (and
  2092.                 (goal wonder-attempt DEFEND)
  2093.                 (stone-amount < 125)
  2094.             )
  2095.         )
  2096.     )
  2097.     (can-sell-commodity wood)
  2098. =>
  2099.     (chat-local-to-self "sell wood")
  2100.     (sell-commodity wood)
  2101. )
  2102.  
  2103. (defrule
  2104.     (food-amount > 500)
  2105.     (or
  2106.         (wood-amount < 225)
  2107.         (or
  2108.             (gold-amount < 225)
  2109.             (and
  2110.                 (goal wonder-attempt DEFEND)
  2111.                 (stone-amount < 125)
  2112.             )
  2113.         )
  2114.     )
  2115.     (can-sell-commodity food)
  2116. =>
  2117.     (chat-local-to-self "sell food")
  2118.     (sell-commodity food)
  2119. )
  2120.  
  2121. (defrule
  2122.     (stone-amount < 650)
  2123.     (gold-amount > 500)
  2124.     (commodity-buying-price stone < 200)
  2125.     (can-buy-commodity stone)
  2126. =>
  2127.     (chat-local-to-self "need stone")
  2128.     (buy-commodity stone)
  2129. )
  2130.  
  2131. (defrule
  2132.     (wood-amount < 225)
  2133.     (gold-amount > 500)
  2134.     (commodity-buying-price wood < 200)
  2135.     (can-buy-commodity wood)
  2136. =>
  2137.     (chat-local-to-self "need wood")
  2138.     (buy-commodity wood)
  2139. )
  2140.  
  2141. (defrule
  2142.     (food-amount < 200)
  2143.     (gold-amount > 500)
  2144.     (commodity-buying-price food < 200)
  2145.     (can-buy-commodity food)
  2146. =>
  2147.     (chat-local-to-self "need food")
  2148.     (buy-commodity food)
  2149. )
  2150.  
  2151. ;*******************************
  2152. ;counterunits
  2153. ;train specialty units
  2154. (defrule
  2155.     (unit-type-count-total heavy-camel < 1)
  2156.     (can-train heavy-camel)
  2157.     (or
  2158.         (or
  2159.             (cc-players-unit-type-count any-enemy knight-line >= five-percent-pop)
  2160.             (cc-players-unit-type-count any-enemy cavalry-archer-line >= five-percent-pop)
  2161.         )
  2162.         (or
  2163.             (cc-players-unit-type-count any-enemy light-cavalry >= five-percent-pop)
  2164.             (cc-players-unit-type-count any-enemy camel-line >= five-percent-pop)
  2165.         )
  2166.     )
  2167. =>
  2168.     (train heavy-camel)
  2169. )
  2170.  
  2171. (defrule
  2172.     (unit-type-count-total heavy-camel < 1)
  2173.     (can-train heavy-camel)
  2174.     (or
  2175.         (or
  2176.             (cc-players-unit-type-count any-enemy cataphract-line >= five-percent-pop)
  2177.             (cc-players-unit-type-count any-enemy war-elephant-line >= five-percent-pop)
  2178.         )
  2179.         (or
  2180.             (cc-players-unit-type-count any-enemy mameluke-line >= five-percent-pop)
  2181.             (cc-players-unit-type-count any-enemy mangudai-line >= five-percent-pop)
  2182.         )
  2183.     )
  2184. =>
  2185.     (train heavy-camel)
  2186. )
  2187.  
  2188. (defrule
  2189.     (unit-type-count-total heavy-camel < five-percent-pop)
  2190.     (can-train heavy-camel)
  2191.     (or
  2192.         (or
  2193.             (cc-players-unit-type-count any-enemy knight-line >= ten-percent-pop)
  2194.             (cc-players-unit-type-count any-enemy cavalry-archer-line >= ten-percent-pop)
  2195.         )
  2196.         (or
  2197.             (cc-players-unit-type-count any-enemy light-cavalry >= ten-percent-pop)
  2198.             (cc-players-unit-type-count any-enemy camel-line >= ten-percent-pop)
  2199.         )
  2200.     )
  2201. =>
  2202.     (train heavy-camel)
  2203. )
  2204.  
  2205. (defrule
  2206.     (unit-type-count-total heavy-camel < five-percent-pop)
  2207.     (can-train heavy-camel)
  2208.     (or
  2209.         (or
  2210.             (cc-players-unit-type-count any-enemy cataphract-line >= ten-percent-pop)
  2211.             (cc-players-unit-type-count any-enemy war-elephant-line >= ten-percent-pop)
  2212.         )
  2213.         (or
  2214.             (cc-players-unit-type-count any-enemy mameluke-line >= ten-percent-pop)
  2215.             (cc-players-unit-type-count any-enemy mangudai-line >= ten-percent-pop)
  2216.         )
  2217.     )
  2218. =>
  2219.     (train heavy-camel)
  2220. )
  2221.  
  2222. (defrule
  2223.     (unit-type-count-total halberdier < 1)
  2224.     (can-train halberdier)
  2225.     (or
  2226.         (or
  2227.             (cc-players-unit-type-count any-enemy knight-line >= five-percent-pop)
  2228.             (cc-players-unit-type-count any-enemy cavalry-archer-line >= five-percent-pop)
  2229.         )
  2230.         (or
  2231.             (cc-players-unit-type-count any-enemy light-cavalry >= five-percent-pop)
  2232.             (cc-players-unit-type-count any-enemy camel-line >= five-percent-pop)
  2233.         )
  2234.     )
  2235. =>
  2236.     (train halberdier)
  2237. )
  2238.  
  2239. (defrule
  2240.     (unit-type-count-total halberdier < 1)
  2241.     (can-train halberdier)
  2242.     (or
  2243.         (or
  2244.             (cc-players-unit-type-count any-enemy cataphract-line >= five-percent-pop)
  2245.             (cc-players-unit-type-count any-enemy war-elephant-line >= five-percent-pop)
  2246.         )
  2247.         (or
  2248.             (cc-players-unit-type-count any-enemy mameluke-line >= five-percent-pop)
  2249.             (cc-players-unit-type-count any-enemy mangudai-line >= five-percent-pop)
  2250.         )
  2251.     )
  2252. =>
  2253.     (train halberdier)
  2254. )
  2255.  
  2256. (defrule
  2257.     (unit-type-count-total halberdier < five-percent-pop)
  2258.     (can-train halberdier)
  2259.     (or
  2260.         (or
  2261.             (cc-players-unit-type-count any-enemy knight-line >= ten-percent-pop)
  2262.             (cc-players-unit-type-count any-enemy cavalry-archer-line >= ten-percent-pop)
  2263.         )
  2264.         (or
  2265.             (cc-players-unit-type-count any-enemy light-cavalry >= ten-percent-pop)
  2266.             (cc-players-unit-type-count any-enemy camel-line >= ten-percent-pop)
  2267.         )
  2268.     )
  2269. =>
  2270.     (train halberdier)
  2271. )
  2272.  
  2273. (defrule
  2274.     (unit-type-count-total halberdier < five-percent-pop)
  2275.     (can-train halberdier)
  2276.     (or
  2277.         (or
  2278.             (cc-players-unit-type-count any-enemy cataphract-line >= ten-percent-pop)
  2279.             (cc-players-unit-type-count any-enemy war-elephant-line >= ten-percent-pop)
  2280.         )
  2281.         (or
  2282.             (cc-players-unit-type-count any-enemy mameluke-line >= ten-percent-pop)
  2283.             (cc-players-unit-type-count any-enemy mangudai-line >= ten-percent-pop)
  2284.         )
  2285.     )
  2286. =>
  2287.     (train halberdier)
  2288. )
  2289.  
  2290. (defrule
  2291.     (unit-type-count-total elite-skirmisher < 1)
  2292.     (can-train elite-skirmisher)
  2293.     (or
  2294.         (or
  2295.             (cc-players-unit-type-count any-enemy archer-line >= five-percent-pop)
  2296.             (cc-players-unit-type-count any-enemy cavalry-archer-line >= five-percent-pop)
  2297.         )
  2298.         (or
  2299.             (cc-players-unit-type-count any-enemy skirmisher-line >= five-percent-pop)
  2300.             (cc-players-unit-type-count any-enemy hand-cannoneer >= five-percent-pop)
  2301.         )
  2302.     )
  2303. =>
  2304.     (train elite-skirmisher)
  2305. )
  2306.  
  2307. (defrule
  2308.     (unit-type-count-total elite-skirmisher < 1)
  2309.     (can-train elite-skirmisher)
  2310.     (or
  2311.         (or
  2312.             (cc-players-unit-type-count any-enemy longbowman-line >= five-percent-pop)
  2313.             (cc-players-unit-type-count any-enemy chu-ko-nu-line >= five-percent-pop)
  2314.         )
  2315.         (or
  2316.             (cc-players-unit-type-count any-enemy mangudai-line >= five-percent-pop)
  2317.             (cc-players-unit-type-count any-enemy janissary-line >= five-percent-pop)
  2318.         )
  2319.     )
  2320. =>
  2321.     (train elite-skirmisher)
  2322. )
  2323.  
  2324. (defrule
  2325.     (unit-type-count-total elite-skirmisher < five-percent-pop)
  2326.     (can-train elite-skirmisher)
  2327.     (or
  2328.         (or
  2329.             (cc-players-unit-type-count any-enemy archer-line >= ten-percent-pop)
  2330.             (cc-players-unit-type-count any-enemy cavalry-archer-line >= ten-percent-pop)
  2331.         )
  2332.         (or
  2333.             (cc-players-unit-type-count any-enemy skirmisher-line >= ten-percent-pop)
  2334.             (cc-players-unit-type-count any-enemy hand-cannoneer >= ten-percent-pop)
  2335.         )
  2336.     )
  2337. =>
  2338.     (train elite-skirmisher)
  2339. )
  2340.  
  2341. (defrule
  2342.     (unit-type-count-total elite-skirmisher < five-percent-pop)
  2343.     (can-train elite-skirmisher)
  2344.     (or
  2345.         (or
  2346.             (cc-players-unit-type-count any-enemy longbowman-line >= ten-percent-pop)
  2347.             (cc-players-unit-type-count any-enemy chu-ko-nu-line >= ten-percent-pop)
  2348.         )
  2349.         (or
  2350.             (cc-players-unit-type-count any-enemy mangudai-line >= ten-percent-pop)
  2351.             (cc-players-unit-type-count any-enemy janissary-line >= ten-percent-pop)
  2352.         )
  2353.     )
  2354. =>
  2355.     (train elite-skirmisher)
  2356. )
  2357.  
  2358. ;***********************************
  2359. ;walls
  2360. (defrule
  2361.     (not (goal wall-build YES) )
  2362. =>
  2363.     (set-goal wall-build NO)
  2364. )
  2365.  
  2366. (defrule
  2367.     (goal wall-build YES)
  2368.     (can-afford-complete-wall 2 stone-wall-line)
  2369.     (can-build-wall-with-escrow 2 stone-wall-line)
  2370. =>
  2371.     (release-escrow stone)
  2372.     (build-wall 2 stone-wall-line)
  2373. )
  2374.  
  2375. (defrule
  2376.     (goal wall-build YES)
  2377.     (building-type-count-total gate < 4)
  2378.     (can-build-gate-with-escrow 2)
  2379. =>
  2380.     (release-escrow stone)
  2381.     (build-gate 2)
  2382. )
  2383.  
  2384. (defrule
  2385.     (goal wall-build YES)
  2386.     (wall-completed-percentage 2 == 100)
  2387. =>
  2388.     (set-goal wall-build NO)
  2389.     (disable-self)
  2390. )
  2391.  
  2392. ;***********************************
  2393. ;towers
  2394. (defrule
  2395.     (building-type-count-total castle > 1)
  2396.     (building-type-count-total bombard-tower < 2)
  2397.     (can-build bombard-tower)
  2398.     (or
  2399.         (goal wall-build NO)
  2400.         (wall-completed-percentage 2 == 100)
  2401.     )
  2402. =>
  2403.     (build bombard-tower)
  2404. )
  2405.  
  2406. (defrule
  2407.     (building-type-count-total castle > 1)
  2408.     (building-type-count-total watch-tower-line < 2)
  2409.     (can-build watch-tower-line)
  2410.     (or
  2411.         (goal wall-build NO)
  2412.         (wall-completed-percentage 2 == 100)
  2413.     )
  2414. =>
  2415.     (build watch-tower-line)
  2416. )
  2417.  
  2418. (defrule
  2419.     (building-type-count-total castle > 2)
  2420.     (building-type-count-total bombard-tower < 5)
  2421.     (can-build bombard-tower)
  2422.     (or
  2423.         (goal wall-build NO)
  2424.         (wall-completed-percentage 2 == 100)
  2425.     )
  2426. =>
  2427.     (build bombard-tower)
  2428. )
  2429.  
  2430. (defrule
  2431.     (building-type-count-total castle > 2)
  2432.     (building-type-count-total watch-tower-line < 5)
  2433.     (can-build watch-tower-line)
  2434.     (or
  2435.         (goal wall-build NO)
  2436.         (wall-completed-percentage 2 == 100)
  2437.     )
  2438. =>
  2439.     (build watch-tower-line)
  2440. )
  2441.  
  2442. (defrule
  2443.     (building-type-count-total castle > 3)
  2444.     (can-build bombard-tower)
  2445.     (or
  2446.         (goal wall-build NO)
  2447.         (wall-completed-percentage 2 == 100)
  2448.     )
  2449. =>
  2450.     (build bombard-tower)
  2451. )
  2452.  
  2453. (defrule
  2454.     (building-type-count-total castle > 3)
  2455.     (can-build watch-tower-line)
  2456.     (or
  2457.         (goal wall-build NO)
  2458.         (wall-completed-percentage 2 == 100)
  2459.     )
  2460. =>
  2461.     (build watch-tower-line)
  2462. )
  2463.  
  2464. ;**********************************************
  2465. ;attack groups
  2466. (defrule
  2467.     (goal wonder-attempt ATTACK)
  2468. =>
  2469.     (enable-timer t-attackgroup 30)
  2470.     (disable-self)
  2471. )
  2472.  
  2473. (defrule
  2474.     (goal wonder-attempt ATTACK)
  2475.     (timer-triggered t-attackgroup)
  2476.     (population >= unit-max)
  2477. =>
  2478.     (set-goal military-parity YES)
  2479. )
  2480.  
  2481. (defrule
  2482.     (goal wonder-attempt ATTACK)
  2483.     (timer-triggered t-attackgroup)
  2484.     (or
  2485.         (military-population >= twenty-percent-pop)
  2486.         (or
  2487.             (and
  2488.                 (players-military-population any-enemy < fifteen-percent-pop)
  2489.                 (military-population >= fifteen-percent-pop)
  2490.             )
  2491.             (and
  2492.                 (players-military-population any-enemy < ten-percent-pop)
  2493.                 (military-population >= ten-percent-pop)
  2494.             )
  2495.         )
  2496.     )
  2497. =>
  2498.     (set-goal military-parity YES)
  2499. )
  2500.  
  2501. (defrule
  2502.     (goal military-parity YES)
  2503.     (unit-type-count-total trebuchet == 0)
  2504.     (unit-type-count-total battering-ram-line == 0)
  2505.     (unit-type-count-total siege-onager == 0)
  2506.     (unit-type-count-total bombard-cannon == 0)
  2507.     (unit-type-count-total elite-tarkan < 10)
  2508.     (unit-type-count-total petard < 3)
  2509.     (military-population < twenty-percent-pop)
  2510. =>
  2511.     (set-goal military-parity NO)
  2512. )
  2513.  
  2514. (defrule
  2515.     (taunt-detected any-ally 201)
  2516. =>
  2517.     (acknowledge-taunt this-any-ally 201)
  2518.     (attack-now)
  2519.     (chat-local-to-self "attack now!")
  2520.     (set-goal military-parity YES)
  2521. )
  2522.  
  2523. (defrule
  2524.     (goal military-parity YES)
  2525. =>
  2526.     (set-strategic-number sn-percent-attack-soldiers 100)
  2527.     (set-strategic-number sn-percent-attack-boats 100)
  2528.     (attack-now)
  2529.     (chat-to-player-using-id every-ally 22406)    ;201
  2530.     (chat-to-player-using-id any-human-ally 22117)
  2531.         ;"39 Attack now!"
  2532. )
  2533.  
  2534. (defrule
  2535.     (goal military-parity NO)
  2536.     (timer-triggered t-attackgroup)
  2537.     (or
  2538.         (or
  2539.             (unit-type-count galley-line > 0)
  2540.             (unit-type-count fire-ship-line > 0)
  2541.         )
  2542.         (or
  2543.             (unit-type-count demolition-ship-line > 0)
  2544.             (unit-type-count cannon-galleon-line > 0)
  2545.         )
  2546.     )
  2547. =>
  2548.     (set-strategic-number sn-percent-attack-soldiers 0)
  2549.     (set-strategic-number sn-percent-attack-boats 100)
  2550.     (attack-now)
  2551.     (chat-local-to-self "boats attack now")
  2552. )
  2553.  
  2554. (defrule
  2555.     (goal military-parity NO)
  2556.     (timer-triggered t-attackgroup)
  2557.     (or
  2558.         (unit-type-count turtle-ship-line > 0)
  2559.         (unit-type-count longboat-line > 0)
  2560.     )
  2561. =>
  2562.     (set-strategic-number sn-percent-attack-soldiers 0)
  2563.     (set-strategic-number sn-percent-attack-boats 100)
  2564.     (attack-now)
  2565.     (chat-local-to-self "boats attack now")
  2566. )
  2567. (defrule
  2568.     (timer-triggered t-attackgroup)
  2569. =>
  2570.     (set-goal military-parity NO)
  2571.     (disable-timer t-attackgroup)
  2572.     (enable-timer t-attackgroup 30)
  2573. )
  2574.  
  2575. (defrule
  2576.     (goal wonder-attempt ATTACK)
  2577. =>
  2578.     (set-strategic-number sn-special-attack-type3 1)
  2579.     (disable-self)
  2580. )
  2581.  
  2582.